<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    <title>6.13. Berkeley DB-4.4.20</title>
    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
  <body id="lfs" class="6.2">
    <div class="navheader">
      <div class="headertitles">
        <h4>Linux From Scratch - 版本 6.2</h4>
        <h3>第六章 安装系统基础软件</h3>
      </div>
      <ul class="headerlinks">
        <li class="prev">
          <a accesskey="p" href="gcc.html" title="GCC-4.0.3">后退</a>
          <p>GCC-4.0.3</p>
        </li>
        <li class="next">
          <a accesskey="n" href="coreutils.html" title="Coreutils-5.96">前进</a>
          <p>Coreutils-5.96</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a></li>
      </ul>
    </div>
    <div class="wrap">
      <div class="titlepage">
        <h1 class="sect1">6.13. Berkeley DB-4.4.20</h1>
      </div>
      <div class="package">
        <p>Berkeley DB 包含一些程序和工具，供其他的一些程序来在做数据库相关函数时调用。</p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">预计编译时间：</span></strong> <span class="seg">1.2 SBU</span>
            </div>
            <div class="seg">
              <strong><span class="segtitle">所需磁盘空间：</span></strong> <span class="seg">77 MB</span>
            </div>
          </div>
        </div>
        <div class="tip">
          <div class="admonhead">
            <img alt="[Tip]" src="../images/tip.png" />
            <h3 class="admontitle">Other Installation Possibilities</h3>
          </div>
          <div class="admonbody">
            <p>如果你需要建立一个 RPC 服务器或者是附加语言绑定编译，在BLFS手册中有一些编译这个软件包的说明。附加语言的绑定编译还需要一些额外的软件包。参见 <a href="http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db"><i>http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db</i></a>的安装说明</p>
            <p>另外，GDBM <span class="emphasis"><em>可以</em></span> 被用来代替
              Berkeley DB 来满足数据库需求。但是，因为在LFS构建过程中，Berkeley DB 被认为是一个核心部分，无法列出在BLFS手册中把它作为依赖的软件（太多了）。同样，很多时候我们测试的是安装了Berkeley DB的LFS系统，而不是 GDBM。如果你清楚的了解了使用 GDBM 的风险和好处，仍然想要采用它，可以参考BLFS手册中的说明 <a href="http://www.linuxfromscratch.org/blfs/view/svn/general/gdbm.html"><i>http://www.linuxfromscratch.org/blfs/view/svn/general/gdbm.html</i></a></p>
          </div>
        </div>
      </div>
      <div class="installation">
        <div class="titlepage">
          <h2 class="sect2">6.13.1. 安装 Berkeley DB</h2>
        </div>
        <p>修补软件包来防止一些潜在的陷井时间：</p>
        <pre class="userinput"><kbd class="command">patch -Np1 -i ../db-4.4.20-fixes-1.patch</kbd></pre>
        <p>为编译 Berkeley DB 做准备：</p>
        <pre class="userinput"><kbd class="command">cd build_unix &amp;&amp;
../dist/configure --prefix=/usr --enable-compat185 --enable-cxx</kbd></pre>
        <div class="variablelist">
          <p class="title">
            <b>配置选项的含义：</b></p>
          <dl>
            <dt>
              <span class="term"><em class="parameter"><tt>--enable-compat185</tt></em></span>
            </dt>
            <dd>
              <p>这个选项指定编译 Berkeley DB 1.85 向上兼容性API。</p>
            </dd>
            <dt>
              <span class="term"><em class="parameter"><tt>--enable-cxx</tt></em></span>
            </dt>
            <dd>
              <p>这个选项指定编译 C++ API 库。</p>
            </dd>
          </dl>
        </div>
        <p>编译软件包：</p>
        <pre class="userinput"><kbd class="command">make</kbd></pre>
        <p>现在测试软件包是没有意义的，因为这将会导致 TCL 捆绑编译。TCL不能被准确的编译，因为 TCL 还是链接到 <tt class="filename">/tools</tt> 下的 Glibc，而不是 <tt class="filename">/usr</tt> 目录下的Glibc。</p>
        <p>安装软件包：</p>
        <pre class="userinput"><kbd class="command">make docdir=/usr/share/doc/db-4.4.20 install</kbd></pre>
        <div class="variablelist">
          <p class="title">
            <b>make 参数的含义：</b></p>
          <dl>
            <dt>
              <span class="term"><em class="parameter"><tt>docdir=...</tt></em></span>
            </dt>
            <dd>
              <p>这条安装命令将db的文档安装到正确的位置。/p>
            </dd>
          </dl>
        </div>
        <p>修改安装文件的属主：</p>
        <pre class="userinput"><kbd class="command">chown -v root:root /usr/bin/db_* \
    /usr/lib/libdb* /usr/include/db* &amp;&amp;
chown -Rv root:root /usr/share/doc/db-4.4.20</kbd></pre>
      </div>
      <div class="content">
        <div class="titlepage">
          <a id="contents-db" name="contents-db"></a>
          <h2 class="sect2">6.13.2. Berkeley DB 的内容</h2>
        </div>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">安装的程序：</span></strong> <span class="seg">db_archive,
              db_checkpoint, db_deadlock, db_dump, db_hotbackup, db_load,
              db_printlog, db_recover, db_stat, db_upgrade, db_verify</span>
            </div>
            <div class="seg">
              <strong><span class="segtitle">安装的库：</span></strong> <span class="seg">libdb.{so,ar}and
              libdb_cxx.r{o,ar}</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3><a id="id3676907" name="id3676907"></a>简要描述</h3>
          <table border="0">
            <col align="left" valign="top" />
            <tbody>
              <tr>
                <td><a id="db_archive" name="db_archive"></a><span class="term"><span><strong class="command">db_archive</strong></span></span></td>
                <td><p>打印出不再使用的日志文件路径名</p></td>
              </tr>
              <tr>
                <td><a id="db_checkpoint" name="db_checkpoint"></a><span class="term"><span><strong class="command">db_checkpoint</strong></span></span></td>
                <td><p>监视和检查数据库日志的守护进程</p></td>
              </tr>
              <tr>
                <td><a id="db_deadlock" name="db_deadlock"></a><span class="term"><span><strong class="command">db_deadlock</strong></span></span></td>
                <td><p>当死锁发生时，退出锁定要求</p></td>
              </tr>
              <tr>
                <td><a id="db_dump" name="db_dump"></a><span class="term"><span><strong class="command">db_dump</strong></span></span></td>
                <td><p>把数据库文件转换成 <span><strong class="command">db_load</strong></span> 能认出的文本文件</p></td>
              </tr>
              <tr>
                <td><a id="db_hotbackup" name="db_hotbackup"></a><span class="term"><span><strong class="command">db_hotbackup</strong></span></span></td>
                <td><p>创建 "<span class="quote">hot
                    backup</span>" 或者是 "<span class="quote">hot
                    failover</span>" 的 Berkeley DB 数据库镜像。</p></td>
              </tr>
              <tr>
                <td><a id="db_load" name="db_load"></a><span class="term"><span><strong class="command">db_load</strong></span></span></td>
                <td><p>从db_dump产生的文本文件中创建出数据库文件</p></td>
              </tr>
              <tr>
                <td><a id="db_printlog" name="db_printlog"></a><span class="term"><span><strong class="command">db_printlog</strong></span></span></td>
                <td><p>把数据库日志文件转换成人能读懂的文本</p></td>
              </tr>
              <tr>
                <td><a id="db_recover" name="db_recover"></a><span class="term"><span><strong class="command">db_recover</strong></span></span></td>
                <td><p>在发生错误后，把数据库恢复到一致的状态</p></td>
              </tr>
              <tr>
                <td><a id="db_stat" name="db_stat"></a><span class="term"><span><strong class="command">db_stat</strong></span></span></td>
                <td><p>显示数据库环境统计</p></td>
              </tr>
              <tr>
                <td><a id="db_upgrade" name="db_upgrade"></a><span class="term"><span><strong class="command">db_upgrade</strong></span></span></td>
                <td><p>把数据库文件转换成新版本的Berkley DB格式</p></td>
              </tr>
              <tr>
                <td><a id="db_verify" name="db_verify"></a><span class="term"><span><strong class="command">db_verify</strong></span></span></td>
                <td><p>对数据库文件进行一致性检查</p></td>
              </tr>
              <tr>
                <td><a id="libdb" name="libdb"></a><span class="term"><tt class="filename">libdb.{so,a}</tt></span></td>
                <td><p>包含db处理相关函数的C库</p></td>
              </tr>
              <tr>
                <td><a id="libdb_cxx" name="libdb_cxx"></a><span class="term"><tt class="filename">libdb_cxx.{so,a}</tt></span></td>
                <td><p>包含db处理相关函数的C++库</p></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="gcc.html" title="GCC-4.0.3">后退</a>
          <p>GCC-4.0.3</p>
        </li>
        <li class="next">
          <a accesskey="n" href="coreutils.html" title="Coreutils-5.96">前进</a>
          <p>Coreutils-5.96</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a>.
        </li>
      </ul>
    </div>
</body></html>
